package com.borrowed.book.system.domain;


import com.borrowed.book.system.util.StringUtils;

public class PageDomain {
    //当前记录起始索引
    private Integer pageNum;
    //每页显示数量
    private Integer pageSize;
    //排序列
    private String  orderByColumn;
    //排序方向 desc or asc
    private String sort="desc";

    public String getOrderBy()
    {
        if (StringUtils.isEmpty(orderByColumn))
        {
            return "";
        }
        return StringUtils.toUnderScoreCase(orderByColumn) + " " + sort;
    }


    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderByColumn() {
        if(StringUtils.isEmpty(orderByColumn)){
            return  "";
        }
        return orderByColumn;
    }

    public void setOrderByColumn(String orderByColumn) {
        this.orderByColumn = orderByColumn;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        if(StringUtils.isNotEmpty(sort))
            this.sort = sort;
    }
}
